package module_one;

import java.util.Random;
import java.util.Scanner;

public class Test04 {

    public static void main(String[] args) {

        System.out.println("请输入班级人数:");

        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();

        int[] scores = new int[num];

        Random random = new Random();
        for (int i = 0;i < num;i++) {
            scores[i] = random.nextInt(101);
        }

        int cnt = 0; //不及格人数
        int totalScore = 0;
        for (int i = 0;i < scores.length;i++) {
            totalScore += scores[i];
            if (scores[i] < 60) {
                cnt++;
            }
        }

        System.out.println("不及格人数:" + cnt);
        double avg = totalScore * 1.0 / num;
        System.out.println("平均分:" + avg);
    }
}
